from prettytable.colortable import Theme
from pyecharts.charts import Bar, Timeline, Line
from pyecharts.globals import ThemeType
from pyecharts.options import LabelOpts

bar1=Bar()
bar2=Bar()

bar1.add_xaxis(["中","美","俄"])
bar1.add_yaxis("GDP",[40,30,20],label_opts=LabelOpts(position="right"))
bar1.reversal_axis()

bar2.add_xaxis(["中", "美", "俄"])
bar2.add_yaxis("GDP", [60, 25, 22],label_opts=LabelOpts(position="right"))
bar2.reversal_axis()

line=Timeline(
    {"theme":ThemeType.LIGHT}
)

line.add(bar1,"2021年")
line.add(bar2,"2022年")

line.render("2021-2022GDP变化.html")

# line1 = Line()
# line2 = Line()
#
# line1.add_xaxis(["中", "美", "俄"])
# line1.add_yaxis("GDP", [40, 30, 20])
#
# line2.add_xaxis(["中", "美", "俄"])
# line2.add_yaxis("GDP", [60, 25, 22])
#
# line = Timeline()
#
# line.add(line1, "2021年")
# line.add(line2, "2022年")
#
# line.render("2021-2022GDP变化.html")
